#include<iostream>
using namespace std;
#include<vector>

#include<queue>


int lastStoneWeight(vector<int>& stones) {
    int n = stones.size();
    priority_queue<int> nums;

    for (int i = 0; i < n; i++)
    {
        nums.push(stones[i]);
    }
    while (nums.size()>=2)
    {
        int number1 = nums.top();
        nums.pop();
        int number2 = nums.top();
        nums.pop();
        if (number1 != number2)
        {
            nums.push(number1 - number2);
        }
    }
    if (nums.size())
    {
        return nums.top();
    }
    return 0;
}


int main()
{
	return 0;
}